<!-- pass a variable to included page -->
<%@ page import="SSP.*" %>
<%@ page import="java.text.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<% 
   String today = null;
   Today t = new Today();
   today = t.getToday();
   request.setAttribute("picture","Dispatcher");
   request.setAttribute("title", "Open Service Order Requests");  
   request.setAttribute("header", "Welcome : Today is " + today); 
   String state ="";
   //state=session.getAttribute("state")+"";
 %>
 <%@ include file="header.jsp"%>
<TD width="850" vAlign="top"> 

<br /><h2>Open Service Order Requests</h2><br />
<table width=100% border=0>



<%String myQuery = "select serviceorder.SERVICEORDERID AS SERVICEORDERID,servicetype.SERVICETYPEDESCRIPTION AS SERVICETYPEDESCRIPTION, "+
"SERVICEORDER.EQUIPMENTID AS EQUIPMENTID,PRODUCT.PRODUCTNAME AS PRODUCTNAME, status.STATUSDESCRIPTION AS STATUSDESCRIPTION "+  
"from serviceorder, servicetype,equipment,product,status, customer, serviceorderaction, location l  Where serviceorder.sostatusid=6 and  "+ 
"customer.customerid = serviceorder.customerid and serviceorder.SERVICETYPEID= servicetype.SERVICETYPEID and "+  
"serviceorder.EQUIPMENTID= equipment.EQUIPMENTID and  equipment.PRODUCTID= product.PRODUCTID and  "+
"equipment.STATUSID= status.STATUSID and  serviceorder.SERVICEORDERID= serviceorderaction.SERVICEORDERID "+ 
"and equipment.locationid = l.locationid and state='CO' and servicetype.SERVICETYPEid in (2,4,5,7) " +
"order by serviceorder.PRIORITYID,customer.servicecontractid";

        
        System.out.println(myQuery);

OraDB myDB = new OraDB();
ResultSet rs = null;
myDB.createConnection();
rs=myDB.Query(myQuery); 
String myopenorders="";

%>
  <tr>
		<th bgcolor="#3B73B9" style="color:white;">Service Order ID</th> 
		<th bgcolor="#3B73B9" style="color:white;">Product Name</th>
		<th bgcolor="#3B73B9" style="color:white;">Status Description</th>
		
		</tr>
	 
<%  while (rs.next()) {   
	if (myopenorders.equals(rs.getString("serviceorderid"))) {
	} else { 
		myopenorders = rs.getString("serviceorderid");%>
		
<%	} %>

        <tr>
		<td><a href="dispatcherassign.jsp?serviceorderid=<%=rs.getString("serviceorderid")%>"><%=rs.getString("serviceorderid")%></a></td>
		
		<td><%=rs.getString("productname")%></td>
		<td><%=rs.getString("statusdescription")%></td>
		</tr>
 <%  } %>
</table>
<%
rs.close();
myDB.closeConnection();
%> 
